Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Warning for Long-Running Message Handlers in Debug Mode #1

Closed
wants to merge 1 commit into from

Conversation

Zimzozaur
Copy link
Owner

This PR addresses issue Textualize#4895

Implemented Features:

  • Warning for Slow Handlers: Logs a warning if a message handler takes longer than 500ms to process.
  • Debug Mode Only: Warnings are enabled only in debug mode to avoid unnecessary overhead in production.
    -Configurable Threshold: The time threshold before a warning is issued can be set via the TEXTUAL_SLOW_THRESHOLD_MS environment variable.

Known Limitations:

Currently, the warning is logged only after the message handler completes. This means that if a handler takes an extended time (e.g., 30 seconds), the warning won’t appear until it finishes.
I have attempted to implement a solution that handles this case in real-time but haven't been able to get it working as intended yet.

Request for Feedback:

If the current implementation is satisfactory, I would appreciate feedback on how to improve the async version for real-time warnings.
Additional Notes:

I am open to any feedback since this is my first code-related PR, and I’m eager to learn and improve.

@Zimzozaur Zimzozaur closed this Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant